
import java.util.Date;
import com.servertrack.*;

class BootStrap {

	def init = { servletContext ->
		Company company=new Company(title:"Company", email:"company@gmail.com", dateCreated: new Date("201/5/7")).save()

		Tur tur1=new Tur(title:"Turkey",description:"This is a good tur", dateCreated: new Date("1989/1/9"))
		company.addToTur(tur1)
		Tur tur2=new Tur(title:"Egypt",description:"This is a very good tur", dateCreated: new Date("1989/1/9"))
		company.addToTur(tur2)


		Hotel hotel1=new Hotel( title:"Hotel Avrora1",adress:"Tverskaya street",website:"www.avrora.ru",description:"description", dateCreated: new Date("1987/2/10"))
		tur1.addToHotel(hotel1)
		Hotel hotel2=new Hotel(title:"Hotel Summer Time1",adress:"Svoboda street",website:"www.summer.ru",description:"description", dateCreated: new Date("2011/5/15"))
		tur2.addToHotel(hotel2)

		//def tur1=new Tur(title:"third", dateCreate: new Date("1989/1/9")).save()
		Times times1=new Times(title:"1.05-15.051",price:1254,dateCreated: new Date("1987/2/10"))
		hotel1.addToTimes(times1)
		Times times2=new Times(title:"4.06-10.061",price:542, dateCreated: new Date("2015/9/16"))
		hotel2.addToTimes(times2)


		Request request1=new Request(title:"Request1",company_name:"turist",count_persons:"2",name_tourist:"Petrova Masha",phone_number:"4756512",description:"qweqwdsdcvdsvadfv",birthDate: new Date("1989/1/9"))
		times1.addToRequest(request1)
		Request request2=new Request(title:"Request1",company_name:"tur_house",count_persons:"2",name_tourist:"Petrov Sasha",phone_number:"4756512",description:"qweqwdsdcvdsvadfv",birthDate: new Date("1989/1/9"))
		times2.addToRequest(request2)
	}
	
	def destroy = {
	}
}
